/*  1:   */ package org.intellij.plugins.relaxNG.compact.psi.impl;
/*  2:   */ 
/*  3:   */

import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiReference;
import org.intellij.plugins.relaxNG.compact.RncTokenTypes;
import org.intellij.plugins.relaxNG.compact.psi.RncDefine;
import org.intellij.plugins.relaxNG.compact.psi.RncElementVisitor;
import org.intellij.plugins.relaxNG.compact.psi.RncRef;
import org.intellij.plugins.relaxNG.compact.psi.util.EscapeUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */ 
/* 14:   */ public class RncRefImpl
/* 15:   */   extends RncElementImpl
/* 16:   */   implements RncRef
/* 17:   */ {
/* 18:   */   public RncRefImpl(ASTNode paramASTNode)
/* 19:   */   {
/* 20:36 */     super(paramASTNode);
/* 21:   */   }
/* 22:   */   
/* 23:   */   @Nullable
/* 24:   */   public RncDefine getPattern()
/* 25:   */   {
/* 26:41 */     PsiReference localPsiReference = getReference();
/* 27:   */     
/* 28:43 */     return (localPsiReference instanceof PatternReference) ? (RncDefine)localPsiReference.resolve() : null;
/* 29:   */   }
/* 30:   */   
/* 31:   */   public String getReferencedName()
/* 32:   */   {
/* 33:47 */     ASTNode localASTNode = findNameNode();
/* 34:48 */     assert (localASTNode != null);
/* 35:49 */     return EscapeUtil.unescapeText(localASTNode);
/* 36:   */   }
/* 37:   */   
/* 38:   */   protected ASTNode findNameNode()
/* 39:   */   {
/* 40:53 */     return getNode().findChildByType(RncTokenTypes.IDENTIFIERS);
/* 41:   */   }
/* 42:   */   
/* 43:   */   public void accept(@NotNull RncElementVisitor paramRncElementVisitor)
/* 44:   */   {
/* 45:58 */     if (paramRncElementVisitor == null) {
/* 46:58 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/intellij/plugins/relaxNG/compact/psi/impl/RncRefImpl", "accept" }));
/* 47:   */     }
/* 48:58 */     paramRncElementVisitor.visitRef(this);
/* 49:   */   }
/* 50:   */   
/* 51:   */   public void accept(CommonElement.Visitor paramVisitor)
/* 52:   */   {
/* 53:62 */     paramVisitor.visitRef(this);
/* 54:   */   }
/* 55:   */   
/* 56:   */   public PsiReference getReference()
/* 57:   */   {
/* 58:67 */     return new PatternReference(this);
/* 59:   */   }
/* 60:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.plugins.relaxNG.compact.psi.impl.RncRefImpl

 * JD-Core Version:    0.7.0.1

 */